import request from '@/utils/request'

// // 分页获取工单列表
// export function getList(data) {
//   return request({
//     url: '/list',
//     method: 'post',
//     data
//   })
// }


// 通过类型获取规则详情
export function getNumRuleDetailByType(params) {
  return request({
    url: '/api/numberRule/getDetailByType',
    method: 'get',
    params
  })
}

// 出入库单列表
export function getList(data) {
  return request({
    url: '/wms/stocks/out/list',
    method: 'get',
    params: data
  })
}
export function getScanList(data) {
  return request({
    url: '/wms/stocks/pda/order/scan',
    method: 'post',
    data: data
  })
}

// 入库单-状态改变
export function stateChange(data) {
  return request({
    url: '/wms/stocks/pda/list/stateChange',
    method: 'post',
    data
  })
}

// 通过id获取规则详情
export function getNumRuleSeqByType (params) {
  return request({
    url: '/api/numberRule/getSeqByType',
    method: 'post',
    data: params
  })
}

// 新增条码
export function newAddBarCode(params) {
  return request({
    url: `/api/bar/code/add`,
    method: 'post',
    data: params
  })
}

// 新增条码进度条
export function getNewAddBarCodeProgress(params) {
  return request({
    url: `/api/bar/code/different/batch/code`,
    method: 'get',
    params
  })
}

export function getWorkerOrderCodeList(data) {
  return request({
    url: `/api/bar/code/list`,
    method: 'post',
    data
  })
}

// 获取清单物料仓库
export function stocksMultiLevelWarehouse (params) {
  return request({
    url: `/wms/stocks/multi/level/Warehouse`,
    method: 'get',
    params
  })
}
  
// 获取关联单据类型
export function getRelateType(params) {
  return request({
    // url: `/wms/stocks/relate/order/type/workOrderComplete`,
    url: `/wms/stocks/relate/order/type/purchase`,
    method: 'get',
    params
  })
}

// 获取申请人列表
export function getUserList(params) {
  return request({
    url: `/api/users/list/company/enabled`,
    method: 'get',
    params
  })
}

// 获取仓管员列表
export function getWarehouseUserList(id, params) {
  return request({
    url: `/wms/stocks/warehouse/user/list/` + id,
    method: 'get',
    params
  })
}

// 新增单据
export function pdaAdd(data) {
  return request({
    url: `wms/stocks/pda/add`,
    method: 'post',
    data
  })
}
// pc端新增入库单接口
export function pdaAddPc(data) {
  return request({
    url: `/wms/stocks/web/input/create/released`,
    method: 'post',
    data
  })
}

// 编辑详情页查询物料接口
export function getMaterialList(data) {
  return request({
    url: `/wms/stocks/pda/edit/material`,
    method: 'post',
    data
  })
}

// 编辑详情页查询物料明细（批次）接口
export function getMaterialDetailsList(data) {
  return request({
    url: `/wms/stocks/pda/edit/materialDetails`,
    method: 'post',
    data
  })
}

// 新增物料明细（批次）接口
export function addMaterialDetails(data) {
  return request({
    url: `/wms/stocks/pda/add/materialDetails`,
    method: 'post',
    data
  })
}

// 新增物料明细（批次）接口
export function materialsList(data) {
  return request({
    url: `/api/materials/list`,
    method: 'post',
    data
  })
}

// 获取物料信息
export function inventoryList(data) {
  return request({
    url: `/wms/stocks/inventory/list`,
    method: 'post',
    data
  })
}

// 物料编码获取物料信息
export function getMaterialInfo(data) {
  return request({
    url: `/wms/stocks/pda/get/materialInfo`,
    method: 'get',
    params: data
  })
}

// 出入库单详情
export function getStockInAndOutById(data) {
  return request({
    url: `/wms/stocks/pda/get/stockInAndOutById`,
    method: 'get',
    params: data
  })
}

export function updateMaterialDetails(data) {
  return request({
    url: '/wms/stocks/pda/update/materialDetails',
    method: 'post',
    data
  })
}

//编辑页提交物料接口
export function updateMaterial(data) {
  return request({
    url: '/wms/stocks/pda/update/material',
    method: 'post',
    data
  })
}

// 关联单号列表
export function productOrdersList(data) {
  return request({
    url: '/ams/receipt/states/list',
    method: 'get',
      params:data
  })
}

// 关联单号查询物料信息批次号
export function materialListByRelate(data) {
  return request({
    url: '/wms/stocks/relate/material/list/by/relate/type', 
    method: 'get',
    params: data
  })
}

// 新增单据
export function materialDetailsInfoList(data) {
  return request({
    url: `/wms/stocks/pda/get/materialDetails`,
    method: 'get',
    params:data
  })
}

//删除物料
export function deleteMaterialDetails(data) {
  return request({
    url: `/wms/stocks/pda/delete/materialDetails`,
    method: 'delete',
    data
  })
}
export function deleteMaterial(data) {
  return request({
    url: `/wms/stocks/pda/delete/material`,
    method: 'delete',
    params:data
  })
}
//查询物料明细
export function materialDetailsByMaterialId(data) {
  return request({
    url: `/wms/stocks/pda/get/materialDetailsByMaterialId`,
    method: 'post',
    data
  })
}

// 根据物料查询物料特征参数列表
export function materialSkuAttrList (data) {
  return request({
    url: '/api/material/sku/attr/list',
    method: 'post',
    data
  })
}

// 新增物料sku
export function addMaterialSku (data) {
  return request({
    url: '/api/material/sku/add',
    method: 'post',
    data
  })
}

// 查询特征值列表
export function auxiliaryAttrValueList (data) {
  return request({
    url: '/api/auxiliary/attr/value/list',
    method: 'post',
    data
  })
}

// 查询物料特征参数列表
export function getAuxiliaryAttrList (data) {
  return request({
    url: '/api/auxiliary/attr/list',
    method: 'post',
    data
  })
}

//扫描批次接口
export function getBarCodeList (data) {
  return request({
    url: `/wms/bar/code/list`,
    method: 'post',
    data
  })
}

export function workordersSimple (data) {
  return request({
    url: `/ams/purchases/list`,
    method: 'post',
    data
  })
}


//打印模板
export function codeType (data) {
  return request({
    url: `/api/bar/code/rule/list`,
    method: 'get',
    params:data
  })
}

//打印
export function inventoryPrint (data) {
  return request({
    url: `/wms/stocks/inventory/print`,
    method: 'post',
    data
  })
}
//多个批次打印
export function inventoryBatchPrint (data) {
  return request({
    url: `/wms/stocks/inventory/batch/print`,
    method: 'post',
    data
  })
}


//物料打印
export function materialPrint (data) {
  return request({
    url: `/wms/stocks/inventory/material/print`,
    method: 'post',
    data
  })
}

// 查询系统中是否存在默认仓库的接口 
export function getDefaultWarehouse(data) {
  return request({
    url: '/wms/stocks/warehouse/get/default',
    method: 'post',
    data
  })
}

export function getInventoryData(data) {
  return request({
    url: '/wms/stocks/inventory/getInventoryData',
    method: 'post',
    data
  })
}

// 获取解析函数
export function scanCodeRuleGet(data) {
  return request({
    url: `/wms/stocks/scan/code/rule/get`,
    method: 'post',
    data
  })
}
// 生产领料单扫码领料确认接口-
export function pdaScanCodeConfirmation(data) {
  return request({
    url: `/wms/stocks/pda/scan/code/confirmation`,
    method: 'post',
   data
  })
}
//物料列表扫码
export function pdaScanCodeMaterial(data) {
  return request({
    url: `/wms/stocks/pda/material/scan`,
    method: 'post',
    data
  })
}
// 编辑详情页查询物料接口(新)
export function getPdaMaterialList(data) {
  return request({
    url: `/wms/stocks/pda/material/list`,
    method: 'post',
    data
  })
}

export function inUpdateMaterialDetails(data) {
  return request({
    url: '/wms/stocks/pda/in/update/materialDetails',
    method: 'post',
    data
  })
}
export function editMaterialRemark(data) {
  return request({
    url: '/wms/stocks/pda/edit/material/remark',
    method: 'get',
    params:data
  })
}
export function updateRemark(data) {
  return request({
    url: '/wms/stocks/pda/updateRemark',
    method: 'post',
    data:data
  })
}

export function selectLaunchSimultaneouslyCode(code,orderNumber) {
  return request({
    url: `/wms/common/selectLaunchSimultaneously?code=${code}&orderNumber=${orderNumber || ''}`,
    method: 'post',
  })
}


//采购入库校验
export function purchaseCheckInQuantity(data) {
  return request({
    url: `/wms/stocks/purchaseCheckInQuantity`,
    method: 'post',
    data
  })
}
//生效后是否允许增加批次
export function configShowConfigGetByKey(orderType) {
  return request({
    url: `/wms/config/show/config/getByKey?orderType=${orderType}`,
    method: 'get',
  })
}
//查询批次
export function infoScanInventory (data) {
  return request({
    url: `/wms/stocks/pda/material/scan/inventory`,
    method: 'post',
    data
  })
}
//获取客户料物料编码
export function suppliersMaterialList (data) {
  return request({
    url: `/wms/stocks/supplier/material`,
    method: 'post',
    data
  })
}
export function inventoryRelate (data) {
  return request({
    url: `/wms/stocks/inventory/relate`,
    method: 'post',
    data
  })
}
//验证数量
export function planNumCompare (data) {
  return request({
    url: `/wms/stocks/plan/num/compare`,
    method: 'get',
    params:data
  })
}

// 扫码校验唯一性
export function getUniqueCheck (data) {
  return request({
    url: `/warehouseChecks/uniqueCheck`,
    method: 'post',
    headers: { 'jun-path': '1' },
    data
  })
}

// 添加扫码校验结果
export function setUniqueCheck (data) {
  return request({
    url: `/warehouseChecks`,
    method: 'post',
    headers: { 'jun-path': '1' },
    data
  })
}

// 在新建入库单的时候---修改入库单的状态
// /purchaseStocks/update
export function reqStateChange (data) {
  return request({
    url: `/purchaseStocks/update`,
    method: 'post',
    headers: { 'jun-path': '1' },
    data
  })
}